import { h } from 'vue';
import { BasicColumn } from '/@/components/Table';
import Tendency from './components/Tendency.vue';

export const tableColumn: BasicColumn[] = [
  {
    title: '月份',
    dataIndex: 'monthTime',
  },
  {
    title: '当月进度',
    dataIndex: 'internalSchedule',
    width: 300,
  },
  {
    title: '累计进度',
    dataIndex: 'totalInternalSchedule',
    width: 300,
  },
  {
    title: '是否变更预算',
    dataIndex: 'changeFlag',
    width: 200,
  },
  {
    title: '当月营收',
    align: 'center',
    children: [
      {
        title: '营收总费用',
        minWidth: 160,
        dataIndex: 'revenue',
        customRender: ({ text, record }) => {
          return h(
            'div',
            {
              style: {
                display: 'flex',
              },
            },
            [
              h('span', null, `￥${text}`),
              h(Tendency, {
                state: record.revenueState,
                data: record.revenueData,
                checked: record.checked,
              }),
            ],
          );
        },
      },
      {
        title: '材料费用',
        minWidth: 160,
        dataIndex: 'materialInternalFee',
        customRender: ({ text, record }) => {
          return h(
            'div',
            {
              style: {
                display: 'flex',
              },
            },
            [
              h('span', null, `￥${text}`),
              h(Tendency, {
                state: record.materialInternalFeeState,
                data: record.materialInternalFeeData,
                checked: record.checked,
              }),
            ],
          );
        },
      },
      {
        title: '施工费',
        minWidth: 160,
        dataIndex: 'constructionInternalFee',
        customRender: ({ text, record }) => {
          return h(
            'div',
            {
              style: {
                display: 'flex',
              },
            },
            [
              h('span', null, `￥${text}`),
              h(Tendency, {
                state: record.constructionInternalFeeState,
                data: record.constructionInternalFeeData,
                checked: record.checked,
              }),
            ],
          );
        },
      },
    ],
  },
  {
    title: '累计营收',
    dataIndex: 'totalRevenue',
    minWidth: 160,
    customRender: ({ text, record }) => {
      return h(
        'div',
        {
          style: {
            display: 'flex',
          },
        },
        [
          h('span', null, `￥${text}`),
          h(Tendency, {
            state: record.totalRevenueState,
            data: record.totalRevenueData,
            checked: record.checked,
          }),
        ],
      );
    },
  },
];
export const tableColumn2: BasicColumn[] = [
  {
    title: '月份',
    dataIndex: 'monthTime',
  },
  {
    title: '当月进度',
    dataIndex: 'schedule',
    width: 300,
  },
  {
    title: '累计进度',
    dataIndex: 'totalSchedule',
    width: 300,
  },
  {
    title: '是否变更预算',
    dataIndex: 'changeFlag',
    width: 200,
  },
  {
    title: '当月成本',
    align: 'center',
    children: [
      {
        title: '当月总成本',
        minWidth: 160,
        dataIndex: 'cost',
        customRender: ({ text, record }) => {
          return h(
            'div',
            {
              style: {
                display: 'flex',
              },
            },
            [
              h('span', null, `￥${text}`),
              h(Tendency, {
                state: record.costState,
                data: record.costData,
                checked: record.checked,
              }),
            ],
          );
        },
      },
      {
        title: '材料费用',
        minWidth: 160,
        dataIndex: 'materialFee',
        customRender: ({ text, record }) => {
          return h(
            'div',
            {
              style: {
                display: 'flex',
              },
            },
            [
              h('span', null, `￥${text}`),
              h(Tendency, {
                state: record.materialFeeState,
                data: record.materialFeeData,
                checked: record.checked,
              }),
            ],
          );
        },
      },
      {
        title: '施工费',
        minWidth: 160,
        dataIndex: 'constructionFee',
        customRender: ({ text, record }) => {
          return h(
            'div',
            {
              style: {
                display: 'flex',
              },
            },
            [
              h('span', null, `￥${text}`),
              h(Tendency, {
                state: record.constructionFeeState,
                data: record.constructionFeeData,
                checked: record.checked,
              }),
            ],
          );
        },
      },
    ],
  },
  {
    title: '整体成本',
    dataIndex: 'totalCost',
    minWidth: 160,
    customRender: ({ text, record }) => {
      return h(
        'div',
        {
          style: {
            display: 'flex',
          },
        },
        [
          h('span', null, `￥${text}`),
          h(Tendency, {
            state: record.totalCostState,
            data: record.totalCostData,
            checked: record.checked,
          }),
        ],
      );
    },
  },
];
